//
//  XLAboutUsVC.m
//  industry
//
//  Created by xl on 2020/12/31.
//  Copyright © 2020 Haier. All rights reserved.
//

#import "XLAboutUsVC.h"
#import "XLAboutUsAdapter.h"
#import "XLWebManager.h"

@interface XLAboutUsVC ()<XLAdapterDelegate>

@property (nonatomic, strong) XLTableView *tableView;
@property (nonatomic, strong) XLAboutUsAdapter *adapter;

@end

@implementation XLAboutUsVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationItem.title = @"关于我们";
    [self buildView];
}

- (void)buildView {
    [self.view addSubview:self.tableView];
    [_tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.bottom.right.equalTo(self.view);
    }];
    
    [_adapter setAdapterArray:@[XLAboutUsAdapterVersion, XLAboutUsAdapterCompanyInfo]];
    [_tableView reloadData];
}

#pragma mark - XLAdapterDelegate
- (void)didSelectCellData:(id)cellData {
    if ([cellData isEqualToString:XLAboutUsAdapterCompanyInfo]) {//公司简介
        [XLWebManager requestOPenWebUrl:[NSString stringWithFormat:@"%@%@", XLServerHttpDomain, XLCompanyInfoHtmlUrl] title:@"公司简介"];
    }
}

#pragma mark - Setter/getter
- (XLTableView *)tableView {
    if (!_tableView) {
        _tableView = [[XLTableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
        _tableView.backgroundColor = [UIColor whiteBgColor];
        _tableView.delegate = self.adapter;
        _tableView.dataSource = self.adapter;
        _tableView.tableFooterView = [UIView new];
    }
    return _tableView;
}

- (XLAboutUsAdapter *)adapter {
    if (!_adapter) {
        _adapter = [[XLAboutUsAdapter alloc] init];
        _adapter.adapterDelegate = self;
    }
    return _adapter;
}

@end
